Skip to content

CoW: Avoid copying Index in Series constructor #52008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Mar 16, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@phofl phofl added Index Related to the Index class or subclasses Series Series data structure Copy / view semantics labels Mar 16, 2023
@phofl phofl added this to the 2.0 milestone Mar 16, 2023
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -399,7 +399,8 @@ def inferred_type(self) -> str:
"""Return a string of the type inferred from the values"""
return "interval"

@Appender(Index.memory_usage.__doc__)
# Cannot determine type of "memory_usage"
@Appender(Index.memory_usage.__doc__) # type: ignore[has-type]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a mypy bug.

Adding

from pandas._libs.internals import BlockValuesRefs

to the base file causes this

@jorisvandenbossche jorisvandenbossche merged commit 396ef60 into pandas-dev:main Mar 17, 2023
@lumberbot-app
Copy link

lumberbot-app bot commented Mar 17, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 2.0.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 396ef60852144b5dcbcd3f23f3455da4854e86a1
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #52008: CoW: Avoid copying Index in Series constructor'
  1. Push to a named branch:
git push YOURFORK 2.0.x:auto-backport-of-pr-52008-on-2.0.x
  1. Create a PR against branch 2.0.x, I would have named this PR:

"Backport PR #52008 on branch 2.0.x (CoW: Avoid copying Index in Series constructor)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@phofl phofl deleted the cow_series_index_constructor branch March 17, 2023 14:41
phofl added a commit to phofl/pandas that referenced this pull request Mar 17, 2023
phofl added a commit that referenced this pull request Mar 17, 2023
…s constructor) (#52048)

CoW: Avoid copying Index in Series constructor (#52008)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Copy / view semantics Index Related to the Index class or subclasses Series Series data structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants